/*******************************************************************
 *
 * Copyright (C), 2021-2022, Letstrong, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-12-17
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
/*----------------------------Head file----------------------------*/
#include "hal_motor.h"
#include "app_motor.h"
#include "sw_timer_task.h"
#include "app_global_data.h"

#define APP_MOTOR_LOG_EN		0

#if APP_MOTOR_LOG_EN
#include "log.h"
#define APP_MOTOR_LOG			LOG_DEBUG
#else
#define APP_MOTOR_LOG(...)
#endif

/*----------------------------macro file---------------------------*/
#define app_motor_one_shot_timer_start(ms)	motor_timer_start(ms);

/*----------------------------type define--------------------------*/

/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/

/*-----------------------------------------------------------------*/

void app_motor_start(uint16_t ms)
{
	if(false == g_app_data.sys.state.motor_running) {
		hal_motor_start();
		g_app_data.sys.state.motor_running = true;
		app_motor_one_shot_timer_start(ms);
	}
}

void app_motor_stop(void)
{
	if(true == g_app_data.sys.state.motor_running) {
		hal_motor_stop();
		g_app_data.sys.state.motor_running = false;
	}
}
